package com.kefu.robot.vo;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractSearchVo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "机器人")
public class RobotInfoSearchVo  extends AbstractSearchVo {

    @ApiModelProperty(name = "robotName", value = "名称")
    private String robotName;
    @ApiModelProperty(name = "robotStatus", value = "机器人状态：0停用，1启用")
    private Integer robotStatus;


    @Override
    public <T>QueryWrapper<T> builder() {
   		QueryWrapper<T> wrapper=Wrappers.query();

        if (robotName != null) {
            wrapper.eq("robot_name", robotName);
        }
        if (robotStatus != null) {
            wrapper.eq("robot_status", robotStatus);
        }

        wrapper.eq("tenant_id", KefuContext.getKefuContext().getTenantId());

        return wrapper;
    }
}